package cn.smbms.service.user;

import java.util.List;

import javax.annotation.Resource;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Service;

import cn.smbms.dao.user.UserMapper;
import cn.smbms.pojo.Product;
import cn.smbms.pojo.User;
import cn.smbms.pojo.User_address;

@Service
public class UserServicelmpl implements UserService {
	@Resource
	private UserMapper userMapper;

	@Override
	public User getUser(String phone) {// 查询user 登录
		// TODO Auto-generated method stub

		User user = userMapper.getUser(phone);

		return user;
	}

	@Override
	public User getUserid(String id) {
		User user = userMapper.getUserid(id);
		return user;
	}

	@Override
	public int updateName(User user) {
		// TODO Auto-generated method stub
		int i = userMapper.updateName(user);
		return i;
	}

	@Override
	public List<Product> getProduct(Integer id) {
		// TODO Auto-generated method stub
		List<Product> product = userMapper.getProduct(id);
		return product;
	}

	@Override
	public List<User_address> getAddressid(Integer id) {
		// TODO Auto-generated method stub
		List<User_address> address = userMapper.getAddressid(id);
		return address;
	}

	@Override
	public User_address getAddressuserid(Integer id) {
		User_address userAddress = userMapper.getAddressuserid(id);
		return userAddress;
	}

	@Override
	public int innerAddress(User_address useraddress) {
		// TODO Auto-generated method stub
		int i = userMapper.innerAddress(useraddress);
		return i;
	}

	@Override
	public int updateAddress(User_address useraddress) {
		int i = userMapper.updateAddress(useraddress);
		return i;
	}

	@Override
	public int saveaddress(Integer id, @Param("userid") Integer userid) {
		userMapper.savedel(userid);
		int i = userMapper.saveaddress(id, userid);
		return i;
	}

	@Override
	public int delAddress(Integer id) {
		int i = userMapper.delAddress(id);
		return i;
	}

	@Override
	public int delCllect(Integer id, Integer userid) {
		int i = userMapper.delCllect(id, userid);
		return i;
	}

	@Override
	public int updateUser(Integer id, String pwd) {
		// TODO Auto-generated method stub
		int i = userMapper.updateUser(id, pwd);
		return i;
	}

	@Override
	public int add(String phone, String pwd) {
		// TODO Auto-generated method stub
		int i = userMapper.add(phone, pwd);
		return i;
	}

	@Override
	public User_address getUser_addressis(Integer userid) {
		// TODO Auto-generated method stub
		User_address useraddress = userMapper.getUser_addressis(userid);
		return useraddress;
	}

	@Override
	public Integer getmax() {
		// TODO Auto-generated method stub
		return userMapper.getmax();
	}

}
